/*
 * @Author: zipeng 1134348223@qq.com
 * @Date: 2024-11-07 23:08:00
 * @LastEditors: zipeng 1134348223@qq.com
 * @LastEditTime: 2025-03-02 12:00:50
 * @FilePath: \mycode\def.h
 * @Description: 
 * 
 * Copyright (c) 2024 by HuaWeiTecho, All Rights Reserved. 
 */
#ifndef DEF_H
#define DEF_H
#include "stdint.h"

#define APP_ID 0
typedef unsigned int uintptr;
#define ADPT_TRUE  1
#define ADPT_FALSE 0
#define ADPT_ERROR (-1)
#define MY_ABS(x) ((x > 0) ? (x) : (-x))
#define RETURN_ERROR_IF(exprrison)     do { if (exprrison) { return ADPT_ERROR; } } while (0)
#define RETURN_ERROR_NOT_IF(exprrison) do { if (!exprrison) { return ADPT_ERROR; } } while (0)
#define RETURN_IF(exprrison)           do { if (exprrison) { return; } } while (0)
#define RETURN_NOT_IF(exprrison)       do { if (!exprrison) { return; } } while (0)
#define GO_TO_EXCEPTION_IF(exprrison, exception)  do { if (exprrison) { goto exception; } } while (0)
#define ARRAY_SIZE(array)              (sizeof(array) / sizeof((array)[0]) )
#define STRU_BIAS(stru, member)        ((uintptr) &(((stru *)(uintptr)0)->member))
#define SET_BIT(bit, word)   ((word) |= (1 << bit))
#define CLEAR_BIT(bit, word) ((word) &= ~(1 << bit))
#define REV_BIT(bit, word)   ((word) ^= (1 << bit))
#define GET_BIT(bit, word)   (((word) &= (1 << bit)) >> bit)
//#define BITS(bit)            (1 << bit)

#endif // !DEF_H

 